package com.ss.SmartStock.redis;

import org.springframework.stereotype.Service;
import redis.clients.jedis.Jedis;
  
@Service
public class ProductManage {
  
    private final Jedis jedis;  
  
    public ProductManage(Jedis jedis) {
        this.jedis = jedis;  
    }  
  
    public void storeProductIdOnline(String productId, long expirationInSeconds) {
        // 使用SETEX命令存储商品ID并设置过期时间
        jedis.setex("product_id_on" + productId, expirationInSeconds, productId);
    }


    public void storeProductIdOffline(String productId, long expirationInSeconds) {
        jedis.setex("product_id_off" + productId, expirationInSeconds, productId);
    }
}